﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BillModeConfig.aspx.cs" Inherits="iEN.Report.BillModeConfig" MaintainScrollPositionOnPostback="true" EnableEventValidation="false"%>
<%@ Register src="../UserControl/TopMenu.ascx" tagname="TopMenu" tagprefix="uc2" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
    </div>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate >
    <table  style="width: 952px">  
        <tr>
            <td><uc2:TopMenu ID="TopMenu1" runat="server" /></td>                
        </tr>
        <tr>
            <td style="background-image:url('../images/title_back.gif')" align="center" ; width="952px" >
                <asp:Label ID="Label1" runat="server" Text="電 價 管 理" BackColor="Transparent" 
                    Font-Names="標楷體" Font-Size="XX-Large" ForeColor="Blue"></asp:Label>
            </td>              
        </tr>
        <tr>
            <td align="center">
                
                    <asp:Label ID="lblMsg" runat="server" Font-Names="微軟正黑體" Font-Size="X-Large" 
                        ForeColor="Red" Text="你沒有瀏覽此頁面的權限" Visible="False"></asp:Label>
                
                    <asp:Panel ID="Panel1" runat="server" BackColor="Transparent" 
                        Font-Names="微軟正黑體,新細明體,標楷體,Arial,sans-serif" Font-Size="16px" ForeColor="Black" 
                        GroupingText="電價設定列表" style="width: 952px">
                        <asp:GridView ID="gvBillMode" runat="server" AutoGenerateColumns="False" 
                            CellPadding="4" DataSourceID="odsBillMode" EmptyDataText="尚未設定相關資料！" 
                            ForeColor="#333333" HorizontalAlign="Center" ondatabound="gvBillMode_DataBound" 
                            onrowdatabound="gvBillMode_RowDataBound" onrowdeleting="gvBillMode_RowDeleting" 
                            onselectedindexchanging="gvBillMode_SelectedIndexChanging" PageSize="50" 
                            style="margin-top: 0px" Width="900px" onrowcommand="gvBillMode_RowCommand">
                            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                            <RowStyle BackColor="#E3EAEB" Font-Size="Medium" />
                            <EmptyDataRowStyle CssClass="note" />
                            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" Font-Size="Medium" 
                                ForeColor="White" />
                            <EditRowStyle BackColor="PaleGoldenrod" />
                            <AlternatingRowStyle BackColor="White" />
                            <Columns>
                                <asp:BoundField DataField="_id" HeaderText="ID" ReadOnly="True" 
                                    SortExpression="_id">
                                <HeaderStyle Font-Names="Arial,sans-serif" HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="_year" HeaderText="學年度" ReadOnly="True" 
                                    SortExpression="_year">
                                <HeaderStyle Font-Names="微軟正黑體,新細明體,標楷體,Arial,sans-serif" 
                                    HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="_mode" HeaderText="計費模式" ReadOnly="True" 
                                    SortExpression="_mode">
                                <HeaderStyle Font-Names="微軟正黑體,新細明體,標楷體,Arial,sans-serif" 
                                    HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="_begin_time" HeaderText="開始日期" ReadOnly="True" 
                                    SortExpression="_begin_time">
                                <HeaderStyle Font-Names="微軟正黑體,新細明體,標楷體,Arial,sans-serif" 
                                    HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="_end_time" HeaderText="結束日期" ReadOnly="True" 
                                    SortExpression="_end_time">
                                <HeaderStyle Font-Names="微軟正黑體,新細明體,標楷體,Arial,sans-serif" 
                                    HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:CommandField ButtonType="Button" EditText="選取" 
                                    ShowSelectButton="True">
                                <ItemStyle Width="50px" />
                                </asp:CommandField>
                                <asp:TemplateField ShowHeader="False">
                                    <ItemTemplate>
                                        <asp:Button ID="Button1" runat="server" CausesValidation="False" 
                                            CommandName="Del" OnClientClick="return confirm('是否刪除？');" Text="刪除" 
                                            CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" />
                                    </ItemTemplate>
                                    <ItemStyle Width="50px" />
                                </asp:TemplateField>
                            </Columns>
                            <PagerTemplate>
                                <asp:Label ID="lbAllCount" runat="server" Text="Label"></asp:Label>
                                <asp:Button ID="First" runat="server" CommandArgument="First" 
                                    onclick="First_Click" Text="第一頁" />
                                <asp:Button ID="Previous" runat="server" CommandArgument="Previous" 
                                    onclick="Previous_Click" Text="前一頁" />
                                <asp:Button ID="Next" runat="server" CommandArgument="Next" 
                                    onclick="Next_Click" Text="下一頁" />
                                <asp:Button ID="Last" runat="server" CommandArgument="Last" 
                                    onclick="Last_Click" Text="最後頁" />
                                <asp:DropDownList ID="dd1PageJump" runat="server" AutoPostBack="True" 
                                    onselectedindexchanged="dd1PageJump_SelectedIndexChanged">
                                </asp:DropDownList>
                                <asp:Label ID="lbAllPage" runat="server" Text="Label"></asp:Label>
                            </PagerTemplate>
                        </asp:GridView>
                        <asp:ObjectDataSource ID="odsBillMode" runat="server" 
                            SelectMethod="getBillModeTable" TypeName="DataAccess.DBAccess">
                        </asp:ObjectDataSource>
                    </asp:Panel>
        <tr>
            <td>
                
                    <asp:Button ID="btAddTag" runat="server" 
                        Font-Names="微軟正黑體,新細明體,標楷體,Arial,sans-serif" Font-Size="Medium" 
                        onclick="btAddTag_Click" Text="新增" />
        <tr>
            <td>
                <tr>
                    <td align="center">
                        <asp:Panel ID="Panel3" runat="server" BackColor="Transparent" 
                            Font-Names="微軟正黑體,新細明體,標楷體,Arial,sans-serif" Font-Size="16px" ForeColor="Black" 
                            GroupingText="修改電價" style="width: 952px" Visible="False">
                            <table style="margin: 0px 0px 0px 5px; border:2px double gray">
                                <tr>
                                            <td class="GrayTxtHeader">
                                                學&nbsp;年 度 :
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="tbYearUpdate" runat="server" Width="150px" Enabled="False"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="GrayTxtHeader">
                                                開始日期 :
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="tbBeginTimeUpdate" runat="server" Width="150px"></asp:TextBox>
                                                <cc1:CalendarExtender ID="ceBeginTimeUpdate" runat="server" CssClass="cssCalendar" 
                                                    Format="yyyy/MM/dd" TargetControlID="tbBeginTimeUpdate">
                                                </cc1:CalendarExtender>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="GrayTxtHeader">
                                                結束日期 :
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="tbEndTimeUpdate" runat="server" Width="150px"></asp:TextBox>
                                                <cc1:CalendarExtender ID="ceEndTimeUpdate" runat="server" CssClass="cssCalendar" 
                                                    Format="yyyy/MM/dd" TargetControlID="tbEndTimeUpdate">
                                                </cc1:CalendarExtender>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="GrayTxtHeader">
                                                計價模式 :
                                            </td>
                                            <td align="left">
                                                <asp:DropDownList ID="ddlModeUpdate" runat="server" AutoPostBack="True" 
                                                    onselectedindexchanged="ddlModeUpdate_SelectedIndexChanged" Width="150px" 
                                                    Enabled="False">
                                                    <asp:ListItem Value="1">上學期</asp:ListItem>
                                                    <asp:ListItem Value="2">下學期</asp:ListItem>
                                                    <asp:ListItem Value="3">暑假</asp:ListItem>
                                                    <asp:ListItem Value="4">寒假</asp:ListItem>
                                                </asp:DropDownList>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="GrayTxtHeader">
                                                費用(每度) :
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="tbBillUpdate" runat="server" Enabled="False" Width="150px">非寒暑假不需輸入</asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Button ID="btnComfirm" runat="server" Text="確定" 
                                                    onclick="btnComfirm_Click" />
                                            </td>
                                        </tr>
                            </table>
                        </asp:Panel>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Panel ID="Panel5" runat="server" BackColor="Transparent" 
                            Font-Names="微軟正黑體,新細明體,標楷體,Arial,sans-serif" Font-Size="16px" ForeColor="Black" 
                            GroupingText="修改電價費率" style="width: 952px" Visible="False">
                            <asp:GridView ID="gvBillModeBill" runat="server" AutoGenerateColumns="False" 
                                CellPadding="4" DataSourceID="odsBillModeBill" EmptyDataText="尚未設定相關資料！" 
                                ForeColor="#333333" HorizontalAlign="Center" PageSize="50" 
                                style="margin-top: 0px" onrowdatabound="gvBillModeBill_RowDataBound" 
                                onrowcommand="gvBillModeBill_RowCommand">
                                <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                <RowStyle BackColor="#E3EAEB" Font-Size="Medium" />
                                <EmptyDataRowStyle CssClass="note" />
                                <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                                <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                                <HeaderStyle BackColor="#1C5E55" Font-Bold="True" Font-Size="Medium" 
                                    ForeColor="White" />
                                <EditRowStyle BackColor="PaleGoldenrod" />
                                <AlternatingRowStyle BackColor="White" />
                                <Columns>
                                    <asp:BoundField DataField="_id" HeaderText="ID" ReadOnly="True" 
                                        SortExpression="_id">
                                    <HeaderStyle Font-Names="Arial,sans-serif" HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="_kwh_start" HeaderText="用電度數(起)" ReadOnly="True" 
                                        SortExpression="_kwh_start">
                                    <HeaderStyle Font-Names="微軟正黑體,新細明體,標楷體,Arial,sans-serif" 
                                        HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="_kwh_end" HeaderText="用電度數(迄)" ReadOnly="True" 
                                        SortExpression="_kwh_end">
                                    <HeaderStyle Font-Names="微軟正黑體,新細明體,標楷體,Arial,sans-serif" 
                                        HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="_bill" HeaderText="費率(元)" SortExpression="_bill">
                                    <HeaderStyle Font-Names="微軟正黑體,新細明體,標楷體,Arial,sans-serif" 
                                        HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:CommandField ShowEditButton="True"></asp:CommandField>
                                    <asp:TemplateField ShowHeader="False">
                                        <ItemTemplate>
                                            <asp:Button ID="Button2" runat="server" CausesValidation="False" 
                                                CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CommandName="Del" 
                                                OnClientClick="return confirm('是否刪除？');" Text="刪除" />
                                        </ItemTemplate>
                                        <ItemStyle Width="50px" />
                                    </asp:TemplateField>
                                </Columns>
                                <PagerTemplate>
                                    <asp:Label ID="lbAllCount0" runat="server" Text="Label"></asp:Label>
                                    <asp:Button ID="First0" runat="server" CommandArgument="First" 
                                        onclick="First_Click" Text="第一頁" />
                                    <asp:Button ID="Previous0" runat="server" CommandArgument="Previous" 
                                        onclick="Previous_Click" Text="前一頁" />
                                    <asp:Button ID="Next0" runat="server" CommandArgument="Next" 
                                        onclick="Next_Click" Text="下一頁" />
                                    <asp:Button ID="Last0" runat="server" CommandArgument="Last" 
                                        onclick="Last_Click" Text="最後頁" />
                                    <asp:DropDownList ID="dd1PageJump0" runat="server" AutoPostBack="True" 
                                        onselectedindexchanged="dd1PageJump_SelectedIndexChanged">
                                    </asp:DropDownList>
                                    <asp:Label ID="lbAllPage0" runat="server" Text="Label"></asp:Label>
                                </PagerTemplate>
                            </asp:GridView>
                            <asp:ObjectDataSource ID="odsBillModeBill" runat="server" 
                                SelectMethod="getBillModeBillTable" TypeName="DataAccess.DBAccess">
                                <SelectParameters>
                                    <asp:SessionParameter DefaultValue="0" Name="strID" SessionField="BillID" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                            <asp:Label ID="lblMax" runat="server" ForeColor="Red" Text="用電度數上限留空，即代表以上"></asp:Label>
                            <br />
                            <table style="margin: 0px 0px 0px 5px; border:2px double gray">
                                <tr>
                                    <td class="GrayTxtHeader">
                                        用電度數 :
                                    </td>
                                    <td align="left">
                                        <cc1:CalendarExtender ID="ceEndTimeUpdate0" runat="server" 
                                            CssClass="cssCalendar" Format="yyyy/MM/dd" TargetControlID="tbEndTimeUpdate">
                                        </cc1:CalendarExtender>
                                        <asp:TextBox ID="tbBillStart" runat="server" Width="65px"></asp:TextBox>
                                        &nbsp;～ 
                                        <asp:TextBox ID="tbBillEnd" runat="server" Width="65px"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="GrayTxtHeader">
                                        費用(每度) :
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="tbBill" runat="server" Width="150px"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Button ID="btnBillAdd" runat="server" onclick="btnBillAdd_Click" 
                                            Text="新增費率" />
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                        <tr>
                            <td align="center">
                                <asp:Panel ID="Panel4" runat="server" BackColor="Transparent" 
                                    Font-Names="微軟正黑體,新細明體,標楷體,Arial,sans-serif" Font-Size="16px" ForeColor="Black" 
                                    GroupingText="新增電價" style="width: 952px" Visible="False">
                                    <table style="margin: 0px 0px 0px 5px; border:2px double gray">
                                        <tr>
                                            <td class="GrayTxtHeader">
                                                學&nbsp;年 度&nbsp; :
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="tbYearAdd" runat="server" Width="150px"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="GrayTxtHeader">
                                                開始日期 :
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="tbBeginTimeAdd" runat="server" Width="150px"></asp:TextBox>
                                                <cc1:CalendarExtender ID="ceBeginTimeAdd" runat="server" CssClass="cssCalendar" 
                                                    Format="yyyy/MM/dd" TargetControlID="tbBeginTimeAdd">
                                                </cc1:CalendarExtender>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="GrayTxtHeader">
                                                結束日期 :
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="tbEndTimeAdd" runat="server" Width="150px"></asp:TextBox>
                                                <cc1:CalendarExtender ID="ceEndTimeAdd" runat="server" CssClass="cssCalendar" 
                                                    Format="yyyy/MM/dd" TargetControlID="tbEndTimeAdd">
                                                </cc1:CalendarExtender>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="GrayTxtHeader">
                                                計價模式 :
                                            </td>
                                            <td align="left">
                                                <asp:DropDownList ID="ddlModeAdd" runat="server" AutoPostBack="True" 
                                                    onselectedindexchanged="ddlModeAdd_SelectedIndexChanged" Width="150px">
                                                    <asp:ListItem Value="1">上學期</asp:ListItem>
                                                    <asp:ListItem Value="2">下學期</asp:ListItem>
                                                    <asp:ListItem Value="3">暑假</asp:ListItem>
                                                    <asp:ListItem Value="4">寒假</asp:ListItem>
                                                </asp:DropDownList>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="GrayTxtHeader">
                                                費用(每度) :
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="tbBillAdd" runat="server" Enabled="False" Width="150px">非寒暑假不需輸入</asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Button ID="btnAdd" runat="server" onclick="YesAdd_Click" Text="確定" />
                                                <asp:Button ID="btnCancel" runat="server" onclick="NoEdit_Click" Text="取消" />
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                            </td>
                        </tr>
                    </td>
                </tr>
            </td>
        </tr>
    </table>
    </ContentTemplate>
    </asp:UpdatePanel>
    </center>
    </form>
</body>
</html>
